﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DBLibrary;

[TableMap("SpendItem")]
public class SpendItemDetail
{
    [ColumnMap("SpendItemId", IsIdentity = true)]
    public long SpendItemId { get; set; }

    [ColumnMap("SpendItemName")]
    public string SpendItemName { get; set; }

    [ColumnMap("SpendItemPrice")]
    public double SpendItemPrice { get; set; }

    [ColumnMap("SpendTypeId")]
    public long SpendTypeId { get; set; }

    private string mSpendTypeName;
    public string SpendTypeName
    {
        get 
        {
            if (string.IsNullOrEmpty(mSpendTypeName))
            {
                mSpendTypeName = PoseidonDBHelper.UserDB.Select<SpendTypeDetail>(new DBParam("SpendTypeId", SpendTypeId))[0].SpendTypeName;
            }
            return mSpendTypeName;
        }
    }
}